package com.ygx.flink.practice.model;

import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

/**
 * @author YangGuoXiang
 * @version 1.0
 * @date 2022/3/25 15:35
 */
public class UserBehavior {

    private int userId;
    private int itemId;
    private int categoryId;
    private String behavior;
    private Timestamp ts;

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public String getBehavior() {
        return behavior;
    }

    public void setBehavior(String behavior) {
        this.behavior = behavior;
    }

    public Timestamp getTs() {
        return ts;
    }

    public void setTs(String ts) {
        String pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        try {
            this.ts = new Timestamp(simpleDateFormat.parse(ts).getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
